import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from "path"

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  server: {
    host: '0.0.0.0',
    open: true,//启动项目自动弹出浏览器
    cors: true,
    port: 4000,//启动端口
    proxy: {
      '/api': {
        target: 'http://localhost:9527',	//实际请求地址
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, '')
      },
    }
  },
  resolve: {
    alias: {
      // @ 替代为 src
      '@': resolve(__dirname, 'src'),
    },
  },
})
